package com.tgpms.web.earlierStage.dao;


import java.util.List;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tgpms.web.earlierStage.entity.ObsInfo;


/**
* 表OBS_INFO -> null 的基本功能实现
*
* @author GK-B-P-GUAN_WEIQUAN-N
* @createDate 2019/12/24
*/
public interface ObsInfoMapper extends BaseMapper<ObsInfo>{
	
	
	//查询管理员权限并没有挂接项目的组织机构
	@Select("select ua.OBS_CODE as obsCode, oi.description as description, oi.parent_id as parentId from users_authority ua left join obs_info oi on ua.obs_code = oi.obs_code "
			+ " where ua.USERS_ID=#{userId} and ua.ADMIN_YN='Y' "
			+ " and ua.OBS_CODE not in (select pi.OBS_CODE from project_info pi left join obs_info temp on pi.obs_code = temp.obs_code where temp.obs_type = 'P3')")
	List<ObsInfo> getUserObsCodes(String userId);

}